package com.example;

import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;

public class BookDB {
    private static Map<String, Book> books = new LinkedHashMap<>();

    static {
        books.put("1", new Book("1", "JavaWeb开发"));
        books.put("2", new Book("2", "JDBC开发"));
        books.put("3", new Book("3", "Java基础"));
        books.put("4", new Book("4", "Struts开发"));
        books.put("5", new Book("5", "Spring开发"));
    }

    public static Collection<Book> getAllBooks() {
        return books.values();
    }

    public static Book getBookById(String id) {
        return books.get(id);
    }
}